home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
PredatorPrey
/
event.c
< prev
next >
Wrap
Text File
|
1996-06-22
|
13KB
|
432 lines
case autoKey:
FindWindow( gTheEvent.where, &wPtr );
if (IsOurWindow(wPtr))
{
DoKeystroke ();
}
else
{
theChar = gTheEvent.message & charCodeMask;
if ((( gTheEvent.modifiers & cmdKey )/* && ( gTheEvent.modifiers & optionKey )*/) != 0)
HandleMenuChoice( MenuKey( theChar ) );
else if((gTheEvent.modifiers & optionKey)&&(gTheEvent.modifiers & controlKey))
{
if ((theChar == 23)) /* control-option-w */
{
GetMouse(&pt);
if (PtInRect(pt, &gDivideRect ))
{
DoTheWiz(); /* in calc_dipshit.c */
}
}
if ((theChar == 8)) /* control-option-h */
{
if(!gHelpNot) gHelpNot = TRUE;
else gHelpNot = FALSE;
}
if ((theChar == 16) && (gIsWizard)) /* control-option-p */
{
DoTheShare(); /* in calc_inits.c */
}
if ((theChar == 19) && (gIsWizard)) /* control-option-s */
{
DoSetPassword();
}
if ((theChar == 25) && (stillWizard)) /* control-option-y */
{
sound = GetResource ('snd ', MutateID);
if (sound != NULL)
{
errCode = SndPlay (NULL, sound, false);
}
if(gIsWizard)
{
gIsWizard = FALSE;
DelMenuItem( GetMHandle(FILE_MENU_ID), 6 );
InsMenuItem( GetMHandle(FILE_MENU_ID), "\pLoad Program/L", 5 );
DelMenuItem( GetMHandle(FILE_MENU_ID), 7 );
InsMenuItem( GetMHandle(FILE_MENU_ID), "\pLoad Data/L", 6 );
}
else
{
gIsWizard = TRUE;
DelMenuItem( GetMHandle(FILE_MENU_ID), 6 );
InsMenuItem( GetMHandle(FILE_MENU_ID), "\pOpen Program/L", 5 );
DelMenuItem( GetMHandle(FILE_MENU_ID), 7 );
InsMenuItem( GetMHandle(FILE_MENU_ID), "\pOpen Data/L", 6 );
}
if(!gLoadProgEnabled)
{
DisableItem(GetMHandle(FILE_MENU_ID), 6);
DisableItem(GetMHandle(FILE_MENU_ID), 7);
}
}
if((theChar == 96))
{
/* Do option-control-` */
}
}
/* else if((gTheEvent.modifiers & optionKey)&&(gTheEvent.modifiers & cmdKey))*/
/* {*/
/* }*/
else
{
charCode = gTheEvent.message & charCodeMask;
switch(charCode)
{
case 9: /* tab char */
wPtr = FrontWindow();
if(one_of_mine(wPtr) || wPtr == gRotateBox || wPtr == gStretchBox)
{
palSet = (**w_objs_hndl).paletteSetting;
if(palSet == CIRCLE_OBJ)
{
weapon_type = (**w_objs_hndl).armament_type;
if(weapon_type == 0) draw_palette(lastPtr); /* in calc_update.c */
else if(weapon_type == 1)
{
if((**w_objs_hndl).arms_selected == 0) (**w_objs_hndl).arms_selected = 1;
else if((**w_objs_hndl).arms_selected == 1) (**w_objs_hndl).arms_selected = 0;
draw_palette(lastPtr); /* in calc_update.c */
}
else if (weapon_type == 2)
{
if((**w_objs_hndl).arms_selected == 0) (**w_objs_hndl).arms_selected = 1;
else if((**w_objs_hndl).arms_selected == 1) (**w_objs_hndl).arms_selected = 2;
else if((**w_objs_hndl).arms_selected == 2) (**w_objs_hndl).arms_selected = 0;
draw_palette(lastPtr); /* in calc_update.c */
}
}
else if(palSet == SQUARE_OBJ)
{
vPtChoice = (**w_objs_hndl).vPtNo;
switch(vPtChoice)
{
case 0:
(**w_objs_hndl).xvPt = 100;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 1;
break;
case 1:
(**w_objs_hndl).xvPt = 200;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 2;
break;
case 2:
(**w_objs_hndl).xvPt = 300;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 3;
break;
case 3:
(**w_objs_hndl).xvPt = 400;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 4;
break;
case 4:
(**w_objs_hndl).xvPt = 500;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 5;
break;
case 5:
(**w_objs_hndl).xvPt = 600;
(**w_objs_hndl).yvPt = 100;
(**w_objs_hndl).vPtNo = 6;
break;
case 6:
(**w_objs_hndl).xvPt = 100;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 7;
break;
case 7:
(**w_objs_hndl).xvPt = 200;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 8;
break;
case 8:
(**w_objs_hndl).xvPt = 300;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 9;
break;
case 9:
(**w_objs_hndl).xvPt = 400;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 10;
break;
case 10:
(**w_objs_hndl).xvPt = 500;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 11;
break;
case 11:
(**w_objs_hndl).xvPt = 600;
(**w_objs_hndl).yvPt = 200;
(**w_objs_hndl).vPtNo = 12;
break;
case 12:
(**w_objs_hndl).xvPt = 100;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo =13;
break;
case 13:
(**w_objs_hndl).xvPt = 200;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo = 14;
break;
case 14:
(**w_objs_hndl).xvPt = 300;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo = 15;
break;
case 15:
(**w_objs_hndl).xvPt = 400;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo = 16;
break;
case 16:
(**w_objs_hndl).xvPt = 500;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo = 17;
break;
case 17:
(**w_objs_hndl).xvPt = 600;
(**w_objs_hndl).yvPt = 300;
(**w_objs_hndl).vPtNo = 18;
break;
case 18:
(**w_objs_hndl).xvPt = 100;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 19;
break;
case 19:
(**w_objs_hndl).xvPt = 200;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 20;
break;
case 20:
(**w_objs_hndl).xvPt = 300;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 21;
break;
case 21:
(**w_objs_hndl).xvPt = 400;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 22;
break;
case 22:
(**w_objs_hndl).xvPt = 500;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 23;
break;
case 23:
(**w_objs_hndl).xvPt = 600;
(**w_objs_hndl).yvPt = 400;
(**w_objs_hndl).vPtNo = 0;
break;
}
InvalRect(&lastPtr->portRect);
do_update(lastPtr);
}
else if(palSet == T_BACKGRND_OBJ || palSet == BACKGRND_OBJ)
{
focalPtChoice = (**w_objs_hndl).focalPtNo;
switch(focalPtChoice)
{
case 0:
(**w_objs_hndl).focalPtNo = 1;
(**w_objs_hndl).focalLn = 1000;
break;
case 1:
(**w_objs_hndl).focalPtNo = 2;
(**w_objs_hndl).focalLn = 500;
break;
case 2:
(**w_objs_hndl).focalPtNo = 3;
(**w_objs_hndl).focalLn = 400;
break;
case 3:
(**w_objs_hndl).focalPtNo = 4;
(**w_objs_hndl).focalLn = 300;
break;
case 4:
(**w_objs_hndl).focalPtNo = 5;
(**w_objs_hndl).focalLn = 200;
break;
case 5:
(**w_objs_hndl).focalPtNo = 6;
(**w_objs_hndl).focalLn = 100;
break;
case 6:
(**w_objs_hndl).focalPtNo = 7;
(**w_objs_hndl).focalLn = 50;
break;
case 7:
(**w_objs_hndl).focalPtNo = 8;
(**w_objs_hndl).focalLn = 20;
break;
case 8:
(**w_objs_hndl).focalPtNo = 9;
(**w_objs_hndl).focalLn = 10;
break;
case 9:
(**w_objs_hndl).focalPtNo = 0;
(**w_objs_hndl).focalLn = 10000;
break;
}
InvalRect(&lastPtr->portRect);
do_update(lastPtr);
}
}
}
break;
case 32: /* space bar */
wPtr = FrontWindow();
if(one_of_mine(wPtr) || wPtr == gRotateBox || wPtr == gStretchBox)
FireGuns(innerSel,outerSel); /* calc_dork.c */
//if((**w_objs_hndl).arms_selected == 1)
// GuideMissle(innerSel,outerSel); /* calc_dork.c */
break;
case 48:
myItemHit = ZERO_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 49:
myItemHit = ONE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 50:
myItemHit = TWO_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 51:
myItemHit = THREE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 52:
myItemHit = FOUR_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 53:
myItemHit = FIVE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 54:
myItemHit = SIX_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 55:
myItemHit = SEVEN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 56:
myItemHit = EIGHT_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 57:
myItemHit = NINE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 46:
myItemHit = DECIMAL_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 43:
myItemHit = PLUS_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 42:
myItemHit = TIMES_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 45:
myItemHit = MINUS_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 47:
myItemHit = DIVIDE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 03:
myItemHit = ENTER_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 28:
myItemHit = ERASE_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 102:
case 70:
myItemHit = FFXN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 103:
case 71:
myItemHit = GFXN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 105: /* "i" */
case 73: /* "I" */
myItemHit = SIN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 109: /* "m" */
case 77: /* "M" */
myItemHit = CHS_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 30:
myItemHit = GFXN_BUTTON;
HandleButtonEvent( myItemHit );
myItemHit = ROLLDN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 31:
myItemHit = ROLLDN_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 115:
case 83:
myItemHit = STO_BUTTON; /* STO_BUTTON is 36 */
HandleButtonEvent( myItemHit );
break;
case 114:
case 82:
myItemHit = RCL_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 29:
myItemHit = EXCHXY_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 65: /* "A" */
case 97: /* "a" */
myItemHit = SQRT_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 66: /* "B" */
case 98: /* "b" */
myItemHit = ETOX_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 67: /* "C" */
case 99: /* "c" */
myItemHit = TENTOX_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 68: /* "D" */
case 100: /* "d" */
myItemHit = YTOX_BUTTON;
HandleButtonEvent( myItemHit );
break;
case 69: /* "E" */
case 101: /* "e" */
myItemHit = INVERSE_BUTTON;
HandleButtonEvent( myItemHit );
break;
}
}
break;
case keyUp: